package top.houry.grpc.service;

import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;
import top.houry.grpc.proto.GreeterGrpc;
import top.houry.grpc.proto.GrpcProto;

import java.io.IOException;

public class GreeterImpl extends GreeterGrpc.GreeterImplBase {

    @Override
    public void syaHello(top.houry.grpc.proto.GrpcProto.HelloRequest request, StreamObserver<top.houry.grpc.proto.GrpcProto.HelloReply> responseObserver) {
        System.out.println("------------------------------------" +request.getName());
        GrpcProto.HelloReply reply = GrpcProto.HelloReply.newBuilder().setMessage("Hello " + request.getName()).build();
        responseObserver.onNext(reply);
        responseObserver.onNext(reply);
        responseObserver.onNext(reply);
        responseObserver.onCompleted();
    }



}
